from django.db import models

# Create your models here.
class BookInfo(models.Model):
    title=models.CharField(max_length=20,verbose_name="标题")
    pub_date=models.DateField(verbose_name='日期')

    def __str__(self):
        return self.title
    class Meta:
        verbose_name = '书籍'
        ordering = ["title"]
        verbose_name_plural = verbose_name

class HeroInfo(models.Model):
    name=models.CharField(max_length=10,verbose_name='名称')
    content=models.CharField(max_length=100,verbose_name='内容')
    gender=models.BooleanField(default=True,verbose_name='性别')
    book=models.ForeignKey(BookInfo,on_delete=models.CASCADE,verbose_name='所在书籍')

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = '英雄'
        verbose_name_plural = verbose_name


